import time
import win32com.client


class FileUpload:
    @staticmethod
    def upload_file(file_path):
        """模拟键盘输入文件路径并回车"""
        sr = win32com.client.Dispatch("WScript.Shell")
        time.sleep(2)
        sr.SendKeys(file_path + '\r\n')  # 输入文件路径并回车
        time.sleep(2)  # 等待上传完成
